<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="开单人改单" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doShow(id){
		var url="/business/BusinessBillEdit.ihtm?id="+id;
		ShowIframe("开单人改单",url,1024,600,"refreshWin()",900,600);
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location=window.location;
		}
	}
	function showMessage(id){
		var defaultUrl="/message/MessageList.ihtm?type=IN&relation_id="+id;
		var url="/message/Main.ihtm?default_url="+encodeURIComponent(defaultUrl);
		showWin(1024,600,url);
	}
	function doSearch(){
		var searchKey=encodeURIComponent(document.getElementById("search_key").value.trim());
		var tsId=document.getElementById("ts_id").value;
		window.location="/business/BusinessBillListForModifySelf.ihtm?search_key="+searchKey+"&ts_id="+tsId;
	}
	function doGo(pageIndex){
		var searchKey=encodeURIComponent("${searchKey}");
		window.location="/business/BusinessBillListForModifySelf.ihtm?search_key="+searchKey+"&ts_id=${tsId}"+"&current_page="+pageIndex;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function DoubleClick(it){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		if(ob_arr.length>=it.getAttribute("index")){
			str=ob_arr[it.getAttribute("index")-1].value;
		}
		if(str==""){
			return;
		}
		doShow(str);
	}
	function doCancel(){
		window.close();
	}
	function doInit(){
		Window_Onload();
		document.getElementById("search_key").focus();
	}
	function checkSearchKey(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
</script>
</head>
<body oncontextmenu="return false" onLoad="doInit();" class="sheet" style="text-align:center;">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto;">
  <div class="sheet-top">
    <div class="content">
      <h2>开单人改单</h2>
      <p>在这里允许开单人修改自己所有未审核的业务单</p>
    </div>
  </div>
  <div class="sheet-list">
    <div class="search-business">
      <div class="content">
        <table width="748">
          <tbody>
            <tr>
				<td align="right">
				  <select name='ts_id' id="ts_id">
					<option value="0">==请选择账套==</option>
					<c:forEach var="item" items="${tsList}">
					<option value="${item.id}" <c:if test="${tsId==item.id}">selected</c:if>>${item.title}</option>
					</c:forEach>
		  		  </select>
	              <input type="text" class="TextBox" id="search_key" name="search_key" onKeyUp="checkSearchKey();" style="width:100px" value="${searchKey}" title="以客户名称、客户拼音字头、摘要、业务单号进行模糊查询">
	              <input type="button" class="buttom search-but" value=" 查 询" onClick="doSearch();" title="以客户名称、客户拼音字头、摘要、业务单号进行模糊查询">
				</td>
            </tr>
           </tbody>      
        </table>
      </div>
	  <%@include file="../inc/AlertMsg.jsp"%>
	  <div class="table-list">
        <table width="100%">      
				<tr >
					<th width="14"></th>
					<th  width="15%">单号</th>
					<th  width="10%">订货日期</th>
					<th  width="25%">订货单位</th>
					<th  width="20%">摘要</th>
					<th  width="10%">交货日期</th>
					<th  width="10%">业务员</th>
					<th  width="10%">操作</th>
				</tr>
				<c:forEach var="item" items="${qr.list}" varStatus="i">
					<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
					<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
					<tr class="${trClass}" index="${i.index+1}" style='cursor:pointer;' ondblclick='javascript:DoubleClick(this)' onClick='javascript:ClickCheck(this)' onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
						<td><input type="radio" name='query_checkbox' value="${item[0].id}"></td>	
						<td>${item[0].billCode}</td>
						<td><fmt:formatDate value="${item[0].orderDate}" pattern="yyyy-MM-dd"/></td>
						<td>${item[1]}<c:if test="${item[0].linkman!=null && item[0].linkman!=''}">(${item[0].linkman})</c:if></td>
						<td>${item[0].content}</td>
						<td>
							<c:if test="${item[0].deliverDate!=null}">
							<fmt:formatDate value="${item[0].deliverDate}" pattern="yyyy-MM-dd"/>
							</c:if>
						</td>
						<td>${item[0].managerName}</td>
						<td>
							<a href="javascript:doShow('${item[0].id}');">修改</a>
							<c:if test="${flags[i.index]!=0}"><a href="javascript:showMessage(${item[0].id});"><img src="/images/warning.gif" border="0"></a></c:if>
						</td>
					</tr>
				</c:forEach>
			</table>
			<%@include file="../inc/Pages.jsp"%>
      </div>
    </div>
  </div>
</div>
</body>
</html>
